package qqtalk.jiemian1;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class findpass {
    private JComboBox select1;
    private JTextField txtanswer;
    private JComboBox select2;
    private JLabel problem1;
    private JLabel answer1;
    private JLabel problem2;
    private JLabel answer2;
    private JTextField txtanswer2;
    public JPanel find;
    private JButton surebtn;
    private JButton deletebtn;
    public static JFrame frame1 = new JFrame("验证密保问题");


    public findpass() {
        surebtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //点击确认，与数据库对比如果错误，提示重新回答，

                // 如果正确进入修改密码页面
                JFrame frame=new JFrame("设置新密码");
                frame.setContentPane(new changepass(frame).change);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setBounds(((Toolkit.getDefaultToolkit().getScreenSize().width) / 2) - 300,
                        ((Toolkit.getDefaultToolkit().getScreenSize().height) / 2) - 300, 600, 600);
                frame.pack();
                frame.setVisible(true);
                frame.setSize(500,300);
                frame1.dispose();

            }
        });
        deletebtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //取消按钮，关闭验证页面
                frame1.dispose();
            }
        });
    }

    public findpass(JFrame frame) {
        frame1=frame;

        surebtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //点击确认，与数据库对比如果错误，提示重新回答，

                // 如果正确进入修改密码页面
                JFrame frame=new JFrame("设置新密码");
                frame.setContentPane(new changepass(frame).change);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setBounds(((Toolkit.getDefaultToolkit().getScreenSize().width) / 2) - 300,
                        ((Toolkit.getDefaultToolkit().getScreenSize().height) / 2) - 300, 600, 600);
                frame.pack();
                frame.setVisible(true);
                frame.setSize(500,300);
                frame1.dispose();

            }
        });
        deletebtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //取消按钮，关闭验证页面
                frame1.dispose();
            }
        });
    }

    public static void main(String[] args) {

        frame1.setContentPane(new findpass().find);
        frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame1.setBounds(((Toolkit.getDefaultToolkit().getScreenSize().width) / 2) - 300,
                ((Toolkit.getDefaultToolkit().getScreenSize().height) / 2) - 300, 600, 600);
        frame1.pack();
        frame1.setVisible(true);
        frame1.setSize(500,350);
    }
}
